package com.swanclouds.redfish.managers;

import com.google.common.base.Preconditions;
import com.swanclouds.api.managers.SyslogService;
import com.swanclouds.core.transport.ClientConstants;
import com.swanclouds.model.common.ActionResponse;
import com.swanclouds.redfish.internal.BaseManagerService;
import com.swanclouds.redfish.managers.domain.SyslogServiceModel;

/**
 * @author 李文强
 * description
 */

public class SyslogServiceImpl extends BaseManagerService implements SyslogService {

    /**
     * 查询华为服务器Syslog资源信息
     * @return SyslogServiceModel
     */
    @Override
    public SyslogServiceModel get() {
        return get(SyslogServiceModel.class,uri(ClientConstants.PATH_MANAGERS_SYSLOGSERVICE,getManagerId())).execute();
    }

    /**
     * 配置Syslog服务信息
     * @return  com.swanclouds.redfish.managers.domain.SyslogServiceModel
     **/
    @Override
    public SyslogServiceModel deploy() {
        return patch(SyslogServiceModel.class, uri(ClientConstants.PATH_MANAGERS_SYSLOGSERVICE))/*.entity()*/.execute();
    }

    /**
     * 发送Syslog测试事件
     * @return  com.swanclouds.model.common.ActionResponse
     **/
    @Override
    public ActionResponse sendTestEvent(SyslogServiceModel syslogServiceModel) {
        Preconditions.checkNotNull(syslogServiceModel.getMemberId(),"MemberId is null");
        return post(ActionResponse.class,uri(ClientConstants.PATH_MANAGERS_SYSLOGSERVICE_SUBMITTESTEVENT,getManagerId())).entity(syslogServiceModel).execute();
    }
}
